import math,re,snowflake.client
from flask import Blueprint,request,make_response,jsonify,redirect
from flask_restful import reqparse
from util.myjwt import myjwt
from util.captcha.captcha import captcha
import json, random, time, requests
from util.myredis import r
from util.smssdk import send_message
from models.user import *

echart_blue = Blueprint("echart",__name__)

@echart_blue.route('/getecharts')
def getecharts():
    # select DATE_FORMAT(create_time,'%Y-%m-%d'),count(*) from user group by DATE_FORMAT(create_time,'%Y-%m-%d');//按天统计数据
    # select DATE_FORMAT(create_time,'%Y-%m-%d') month ,count(*) c from user group by month;//按天统计数据


    sql = db.session.execute("select DATE_FORMAT(create_time,'%Y-%m-%d') month ,count(*) c from user group by month")
    list = []
    for i in sql:
        list.append({'value':i.c,'name':i.month})
    return jsonify({'code':200,'data':list})
